
import {
  getUserInfo,
  setUserInfo
} from '../../utils/store';
import api from "../../utils/apiInstance"
Page({
  /**
   * 页面的初始数据
   */
  data: {
    records: [],
    x: 10, //添加的拖拽X轴
    y: 500 //添加的拖拽Y轴
  },

  addTouchStart: function (e) {
    this.startX = e.touches[0].pageX;
    this.startY = e.touches[0].pageY;
  },
  addTouchMove: function (e) {
    const moveX = e.touches[0].pageX;
    const moveY = e.touches[0].pageY;
    const dx = moveX - this.startX;
    const dy = moveY - this.startY;

    this.setData({
      x: this.data.x + dx,
      y: this.data.y + dy
    });

    this.startX = moveX;
    this.startY = moveY;
  },

  async getList () {
    var that = this;
    let res = await api.get(`/punishTicket/wx/list`);
    that.setData({
      records: res.rows
    })
  },
  setKeyword(e) {
    this.setData({
      keyword: e.detail.value
    })
  },
  goAdd() {
    wx.navigateTo({
      url: '/pages/punish-detail/punish-detail',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    this.getList();
    this.startX = 0;
    this.startY = 0;
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})